package com.lx.regex;

import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;

public class chronoUnitdemo {
    public static void main(String[] args) {
        LocalDateTime today = LocalDateTime.now();
        System.out.println(today);

        LocalDateTime birthday = LocalDateTime.of(2000, 1, 1, 1, 0, 0);
        System.out.println(birthday);

        System.out.println("相差的年数"+ ChronoUnit.YEARS.between(today,today));
        System.out.println("相差的月数"+ChronoUnit.MONTHS.between(today,birthday));
        System.out.println("相差的周数"+ChronoUnit.WEEKS.between(today,birthday));
    }
}
